<template>
  <el-card class="box-card">
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="科室名字">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">立即创建</el-button>
        <el-button @click="cancel">取消</el-button>
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script>
  import {add} from '@/network/dept'

  export default {
    name: 'DeptAdd',
    methods: {
      onSubmit() {
        console.log(this.form)
        add(this.form).then(res => {
          this.$router.back(1)
        })
      },
      cancel() {
        this.$router.back(1)
      }
    },
    data() {
      return {
        form: {
          name: '',
          userid: window.sessionStorage.getItem("userid")
        }
      }
    }
  }
</script>

<style scoped>

</style>
